<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateStepCategoryRelationTable extends AbstractMigration
{
    public function up()
    {
        $this->table('step_category_relation', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '环节上下游'])
            ->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '主键ID'])
            ->addColumn('source_step_category_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '下游环节'])
            ->addColumn('target_step_category_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '上游环节'])
            ->addColumn('project_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目ID'])
            ->save();
    }

    public function down()
    {
        $this->table('step_category_relation')->drop()->save();
    }
}
